import React, { forwardRef } from 'react'
import { Form, Input } from 'antd'

const BasicForm = forwardRef((props, ref) => {
    const [form] = Form.useForm()
    const { title } = props

    const getMessage = () => {
        return `请输入新建${title}`
    }

    return (
        <Form
            ref={ref}
            form={form}
            layout="vertical"
            name="form_in_modal"
        >
            <Form.Item
                name="title"
                label={title}
                rules={[{
                    required: true,
                    message: getMessage()
                }]}
            ><Input placeholder={getMessage()} /></Form.Item>
        </Form>
    )
})

export default BasicForm